package com.luyun.frogpay.view.home;

import com.luyun.frogpay.base.baseclass.BaseResponse;
import com.luyun.frogpay.base.network.request.RetrofitFactory;
import com.luyun.frogpay.pojo.request.RequestBase;
import com.luyun.frogpay.pojo.response.AuthInfoRsp;
import com.luyun.frogpay.pojo.response.CodePayRsp;

import javax.inject.Inject;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class HomeModel implements HomeContract.IHomeModel {

    @Inject
    public HomeModel() {
    }

    @Override
    public Observable<BaseResponse<AuthInfoRsp>> getAuthInfo(RequestBase requestBase) {
        return RetrofitFactory.getInstence()
                .API()
                .getAuthInfo(requestBase)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Override
    public Observable facePay(RequestBase requestBase) {
        return RetrofitFactory.getInstence()
                .API()
                .facePay(requestBase)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Override
    public Observable<BaseResponse<CodePayRsp>> codePay(RequestBase requestBase) {
        return RetrofitFactory.getInstence()
                .API()
                .codePay(requestBase)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}
